/**
 * Created by Administrator on 2017/5/25.
 */
"use strict";
//引入模块
const mongoose = require('mongoose');
const db = require('./db');

// Schema 结构
var HotsearchSchema = new mongoose.Schema({
    hsid      :{type:Number,index: true},//hsid
    bName     :{type:String,index: true},//书名
    num    :{type : Number}//搜索数
});

HotsearchSchema.statics.findFn = function(obj,obj1, callback) {
    return this.model('Hotsearch').find(obj, callback).sort(obj1);
};
HotsearchSchema.statics.findF = function(obj,callback) {
    return this.model('Hotsearch').find(obj, callback);
};
HotsearchSchema.statics.findFnLimit = function(obj,obj1,num1,callback) {
    return this.model('Hotsearch').find(obj).sort(obj1).limit(num1).exec(callback);
};
HotsearchSchema.statics.updateFn = function(obj,obj1,callback) {
    return this.model('Hotsearch').update(obj,obj1).exec(callback);
};
HotsearchSchema.statics.findSortOne = function(obj,obj1,callback) {
    return this.model('Hotsearch').findOne(obj).sort(obj1).exec(callback);
};
HotsearchSchema.statics.findConut = function(obj,callback) {
    return this.model('Hotsearch').find(obj).count().exec(callback);
};

var HotsearchModel = db.model('Hotsearch', HotsearchSchema);

module.exports=HotsearchModel;